package aima.search;

import java.lang.*;
import java.util.*;

/** 
   A state class that supplies a general implementation of successors() 
   function for any traversable state space.
*/


public abstract class TraversableState implements State, Traversable {


/**
   Return successors using methods in Traversable interface.
*/
   public Enumeration successors() { 

       Vector successorVec = new Vector();

       Enumeration opList = validOperators();

       while (opList.hasMoreElements()) {
             String op = (String) opList.nextElement();
             successorVec.addElement(
                         new Successor(applyOperator(op), op, costOf(op)) );  
       }
     
       return successorVec.elements();
   }

}
